/**
 * 
 */
package com.mc.tool;

import java.io.File;
import java.util.Objects;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import cn.hutool.core.io.FileUtil;

/**
 * 分类检索
 * 
 * @author w.weizhen
 *
 */
public class FenJian
{
    public static final String user_dir = System.getProperty("user.dir") + File.separator;
    
    public static final String data_path = user_dir + "data" + File.separator + "FenJian" + File.separator;
    
    /**
     * @param args
     */
    public static void main(String[] args)
    {
        File dataPaht = new File(data_path);
        if(!dataPaht.exists())
        {
            dataPaht.mkdirs();
        }
        
        String jsonStr = FileUtil.readUtf8String(FileUtil.file(data_path + "now.json"));
        JSONArray nowJsonArr = JSON.parseArray(jsonStr);
        System.out.println(nowJsonArr);
        
        jsonStr = FileUtil.readUtf8String(FileUtil.file(data_path + "word.json"));
        JSONArray wordJsonArr = JSON.parseArray(jsonStr);
        System.out.println(wordJsonArr);
        
        for (int i = 0; i < nowJsonArr.size(); i++)
        {
            JSONObject nowJsonObj = nowJsonArr.getJSONObject(i);
            Boolean isin = false;
            for (int j = 0; j < wordJsonArr.size(); j++)
            {
                JSONObject wordJsonObj = wordJsonArr.getJSONObject(j);
//                if(Objects.equals(nowJsonObj.getString("name"), wordJsonObj.getString("name")) && Objects.equals(nowJsonObj.getString("depart"), wordJsonObj.getString("depart")))
//                {
//                    isin = true;
//                    break;
//                }
                
                if(Objects.equals(nowJsonObj.getString("name"), wordJsonObj.getString("name")))
                {
                    isin = true;
                    break;
                }
            }
            if(!isin && !Objects.equals("测试部", nowJsonObj.getString("depart")))
            {
                System.out.println(nowJsonObj);
            }
        }
        
        
        
        
        
        
        
        
    }
    
    
    
    
}